<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
  <div class="layui-form-item">
    <label class="layui-form-label">上级分类</label>
    <div class="layui-input-block">
      <select name="pid">
		<option value="0">顶级分类</option>
		<volist name="catelist" id="val" >
			<option value="{$val.id}" <if condition="$pid eq $val['id']"> selected=""</if>>{$val.name}</option>
				<volist name="val['erji']" id="vo">
					<option value="{$vo.id}" <if condition="$pid eq $vo['id']"> selected=""</if>>&nbsp;&nbsp;&nbsp;├─ {$vo.name}</option>
				</volist>
		</volist>
	   </select>
    </div>
  </div>
 
  <div class="layui-form-item">
    <label class="layui-form-label">分类名称</label>
    <div class="layui-input-block">
      <input type="text" name="name" id="name" lay-verify="name" placeholder="请输入" class="layui-input" >
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-block">
      <input type="number" name="ordid" id="ordid" lay-verify="ordid" placeholder="请输入" class="layui-input" value="10">
    </div>
  </div>
   
   
  <div class="layui-form-item"  pane="">
    <label class="layui-form-label">{:L('enabled')}</label>
    <div class="layui-input-block">
      <input type="radio" title="{:L('yes')}" name="status" value="1"  checked="checked">
      <input type="radio" title="{:L('no')}" name="status" value="0">
    </div>
  </div>
  <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="content_edit">提交保存</button>
        </div>
    </div>
</form>

<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
layui.use(['layer','jquery','form','element'], function () {
   // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element;
  	//验证表单
  	form.verify({
	  name: function(value, item){ //value：表单的值、item：表单的DOM对象
	    if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
	      return '不能有特殊字符';
	    }
	    if(/(^\_)|(\__)|(\_+$)/.test(value)){
	      return '首尾不能出现下划线\'_\'';
	    }
	    if(/^\d+\d+\d$/.test(value)){
	      return '不能全为数字';
	    }
	  }
  	  
	});    
     

 //参数：layui、名称、更新的formid、更新的url：module/method、更新后跳转的url（为空则不跳转）、编辑器id、标签id（为空则不获取）
  Oper.initUpdate(layui, '文档分类', 'content_edit', 'doc_cate/add');


});
</script>